package com.chenfan.finance.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chenfan.finance.model.CfSalesorderHeader;
import com.chenfan.finance.model.TocSalesOrderHeader;
import com.chenfan.finance.model.vo.TimeRange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Mapper
public interface CfSalesorderHeaderMapper  extends BaseMapper<TocSalesOrderHeader> {

    /**
     * 批量插入数据
     * @param cfSalesorderHeaderList
     * @param taskYearMonth
     * @return
     */
    int insertList(@Param("list")List<TocSalesOrderHeader> cfSalesorderHeaderList,@Param("taskYearMonth") LocalDateTime taskYearMonth);

    /**
     *  批量插入简易表数据
     * @param cfSalesorderHeaderList
     * @param taskYearMonth
     * @return
     */
    int insertListSimplify(@Param("list")List<TocSalesOrderHeader> cfSalesorderHeaderList,@Param("taskYearMonth") LocalDateTime taskYearMonth);

    /**
     * 根据tid 查询对应的交易单
     * @param tid
     * @param start
     * @param end
     * @return
     */
    List<TocSalesOrderHeader> getByTid(@Param("tid") String tid, @Param("start") LocalDateTime start,@Param("end") LocalDateTime end);

    /**
     * 根据tradeId 查询对应的交易单
     * @param tradeId
     * @param timeRange
     * @return
     */
    List<TocSalesOrderHeader> getByTradeId(@Param("tradeId")Long tradeId, @Param("timeRange") TimeRange timeRange);

    /**
     * 复制原表内容至简易表
     * @param taskYearMonth
     * @return
     */
    int copyDataToSimplify(@Param("taskYearMonth") LocalDateTime taskYearMonth);


    /**
     * tid 查询对应的交易单
     * @param tid
     * @param timeRange
     * @return
     */
    List<TocSalesOrderHeader> getByTidTimeRange(@Param("tid")Long tid, @Param("timeRange") TimeRange timeRange);

    List<TocSalesOrderHeader> getListByIds(@Param("list")List<String> list,@Param("timeRange")TimeRange timeRange);

}